<?php

namespace app\home\controller\order;


use app\home\controller\AuthController;
use app\home\model\order\StoreOrder as StoreOrderModel;
use app\models\store\StoreOrderCar;
use services\{JsonService as Json, UtilService as Util};
/**
 * 订单控制器
 * Class StoreOrder
 * @package app\home\controller\order
 */
class StoreOrder extends AuthController
{
    /**
     * 订单模型的首页的数据
     * @return string
     */
    public function index()
    {
        $this->assign([
            'year' => getMonth(),
            'real_name' => $this->request->get("real_name", ''),
            'status' => $this->request->param("status", ''),
            'orderCount' => StoreOrderModel::orderCount(),
            'payTypeCount' => StoreOrderModel::payTypeCount(),
        ]);
        return $this->fetch();
    }

    /**
     * 订单的列表
     */
    public function order_list()
    {
        $where = Util::getMore([
            ['status',''],
            ['real_name',$this->request->param('real_name','')],
            ['is_del',0],
            ['data',''],
            ['type',''],
            ['pay_type',''],
            ['order',''],
            ['page',1],
            ['limit',20],
            ['excel',0]
        ]);
        // 获取洗车记录
        $carOrderData = StoreOrderCar::OrderListCar($where);
        return Json::successlayui($carOrderData);
        return Json::successlayui(StoreOrderModel::OrderList($where));
    }
}